"use strict";
{
    //声明函数
    function add(a, b) {
        return a + b;
    }
    add(1, 2);
    let minus = function (a, b) {
        return a - b;
    };
    minus(20, 10);
    //声明函数
    let times = (a, b) => {
        return a * b;
    };
    console.log(times(10, 20));
    //函数变量的类型
    let fn;
    fn = (a, b) => {
        return a + b;
    };
    // : 后边 = 前边的内容都是类型声明
    let fn2 = (a, b) => {
        return a + b;
    };
    //声明函数  str.slice(1)  str.slice(1, 5);
    // function slice(start: number, end ?: number){
    // }
    // slice(1, 5);
    // slice(1);
    function buildPhone(code, area = '+86') {
        return area + code;
    }
    console.log(buildPhone('14856238954'));
    console.log(buildPhone('15896582547'));
    console.log(buildPhone('15896582569'));
    console.log(buildPhone('15896582578'));
    console.log(buildPhone('15896582578', '+123'));
    //rest 参数    push  unshift  splice
    function jia(...args) {
        return args.reduce((prev, cur) => prev + cur);
    }
    console.log(jia(1, 2, 3, 4, 5));
}
